package com.API;

public class Quickrow02 {
    public static void main(String[] args) {
        int[] arr = {2, 3, 5, 7, 1, 4, 9, 8, 10, 6};
        quiteSort1(arr, 0, arr.length - 1);
        for (int i = 0; i < arr.length; i++) {
            System.out.println(arr[i] + " ");
        }
    }

    private static void quiteSort1(int[] arr, int lfte, int resty) {
        if (resty < lfte) {
            return;
        }
        int lfte0 = lfte;
        int resty0 = resty;
        int baseNumber = arr[lfte0];
        while (lfte != resty) {
            while (arr[resty] >= baseNumber && lfte < resty) {
                resty--;
            }
            while (arr[lfte] <= baseNumber && lfte < resty) {
                lfte++;
            }
            int temp = arr[lfte];
            arr[lfte] = arr[resty];
            arr[resty] = temp;
        }
        int temp = arr[lfte];
        arr[lfte] = arr[lfte0];
        arr[lfte0] = temp;
        quiteSort1(arr, lfte0, lfte - 1);
        quiteSort1(arr, resty + 1, resty0);
    }
}
